import re

QUERY = -2
homePage = u'FrontPage'
wikiWordRegEx = re.compile(r'\s([A-Z][a-z0-9]+[A-Z][a-z0-9]+([A-Z][a-z0-9]+)*)\s')

categories = [
    'News',
    'Home',
    'Sport',
    'People',
    'Pictures',
    'Software',
    'Philosophy',
    'Travel',
    'Friends']
categories.sort()

staticDir = './static'
tmplDir = staticDir+'/templates'
homeTemplate = tmplDir+'/home.xhtml'
insertTemplate = tmplDir+'/insert.xhtml'
catsTemplate = tmplDir+'/categories.xhtml'

def matchWikiWord(someWord):
    return wikiWordRegEx.match(" %s " % someWord)

def frontPageName():
    return homePage

class HomePage(object):
    id = homePage
    title = u'Front Page'
    author = u'duncan'
    category = u'Software'
    content = u'''This is the FrontPage of your new wiki. 
        You may edit this text, add WikiWords, click on WikiWords 
        to view or create the pages for those words, etc.'''

class ReadMe(object):
    id = u'ReadMe'
    title = u'ReadMe'
    author = u'duncan'
    category = u'Software'
    content = unicode("<pre>%s</pre>" % open('./README').read())

class SoftwareLicense(object):
    id = u'SoftwareLicense'
    title = u'License'
    author = u'duncan'
    category = u'Software'
    content = unicode("<pre>%s</pre>" % open('./LICENSE').read())

def getPreinstalledPages():
    return [HomePage, ReadMe, SoftwareLicense]


